#ifndef MAINWIDGET_H
#define MAINWIDGET_H

#include <QWidget>
#include <QCameraInfo>
#include <QTimer>
//#include "camera.h"
#include "videocapture.h"
#include "settingdialog.h"

struct AVFrame;

QT_BEGIN_NAMESPACE
namespace Ui { class MainWidget; }
QT_END_NAMESPACE

class MainWidget : public QWidget
{
    Q_OBJECT

public:
    MainWidget(QWidget *parent = nullptr);
    ~MainWidget();

    void enableFps();
    void disableFps();

private:
    //    更新相机列表
    void updateCameraList();


private slots:
    void on_pushButton_setting_clicked();

    void on_pushButton_opencamera_clicked();

//    void onAppending_frame(cv::Mat frame);

    void onAppending_YUVframe(AVFrame* frame);

    void updateFPS();
private:
    Ui::MainWidget *ui;
    SettingDialog m_setting;
//    Camera m_camera;

    VideoCapture m_capture;
    //
    QTimer m_timer;
    quint32 m_iFrame_count{0};
    bool enable_fps{true};
};
#endif // MAINWIDGET_H
